package components;

public class Heater {
	public static final int MAX_TEMP = 100;
	private int temp = 0;

	public void increaseTemp(int temp) {
		while (this.temp < temp) {
			this.temp += 5;
			System.out.println("Increasing temperature: " + this.temp);
			try {
				Thread.sleep(5000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			
			if(this.temp > MAX_TEMP){
				System.out.println("Ovearheated!!!");
				decreaseTemp(0);
			}
		}
	}

	public void decreaseTemp(int temp) {
		while(this.temp > temp){
			this.temp -= 5;
			System.out.println("Decreasing temperature: " + this.temp);
			try {
				Thread.sleep(5000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		
	}

	public int getTemp() {
		return temp;
	}

}
